<?php
namespace BP\DA;
class CashFrmTemplate {
	protected static $_hts;	// Hashtable
	protected static $lockObj;	// Object
	public static function __staticinit() { // static class members
		self::$lockObj = new Object();
	}
	public static function Put ($frmID, $ds) // [String frmID, DataSet ds]
	{
		$json = $BP->Tools->Json->ToJson($ds);
		/* !!! synchronized block not supported !!!: (self::$lockObj) */
		{
			if ((self::$_hts == NULL))
			{
				self::$_hts = []; //map
			}
			if ((self::$_hts->containsKey($frmID) ==  FALSE ))
			{
				self::$_hts->put($frmID, $json);
			}
			else
			{
				self::$_hts->put($frmID, $json);
			}
		}
	}
	public static function Remove ($frmID) // [String frmID]
	{
		/* !!! synchronized block not supported !!!: (self::$lockObj) */
		{
			if ((self::$_hts == NULL))
			{
				self::$_hts = []; //map
			}
			self::$_hts->remove($frmID);
		}
	}
	public static function GetFrmDataSetModel ($frmID) // [String frmID]
	{
		/* !!! synchronized block not supported !!!: (self::$lockObj) */
		{
			if ((self::$_hts == NULL))
			{
				self::$_hts = []; //map
			}
			if ((self::$_hts->containsKey($frmID) ==  TRUE ))
			{
				$json = ( (self::$_hts->get($frmID) instanceof String) ? self::$_hts->get($frmID) : NULL );
				$ds = $BP->Tools->Json->ToDataSet($json);
				return $ds;
			}
			return NULL;
		}
	}
	public static function GetFrmJsonModel ($frmID) // [String frmID]
	{
		/* !!! synchronized block not supported !!!: (self::$lockObj) */
		{
			if ((self::$_hts == NULL))
			{
				self::$_hts = []; //map
			}
			if ((self::$_hts->containsKey($frmID) ==  TRUE ))
			{
				$json = ( (self::$_hts->get($frmID) instanceof String) ? self::$_hts->get($frmID) : NULL );
				return $json;
			}
			return NULL;
		}
	}
}
CashFrmTemplate::__staticinit(); // initialize static vars for this class on load
?>
